package com.hhkj.admin.student.service.base.impl;

import com.hhkj.admin.student.domain.Student;
import com.hhkj.admin.student.mapper.StudentCourseMapper;
import com.hhkj.admin.student.mapper.StudentMapper;
import com.hhkj.admin.student.model.dopo.StudentDo;
import com.hhkj.admin.student.model.dopo.StudentPo;
import com.hhkj.admin.student.model.req.StudentReq;
import com.hhkj.admin.student.service.base.StudentService;
import com.hhkj.admin.train.domain.Train;
import com.hhkj.admin.train.model.dopo.TrainPo;
import com.ruoyi.common.base.biz.service.base.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 学员信息Service业务层处理
 *
 * @author ruoyi
 * @since 2023-05-12
 */
@Service
public class StudentServiceImpl extends BaseServiceImpl<Student, StudentDo, StudentPo, StudentMapper> implements StudentService {
    @Autowired
    private StudentCourseMapper studentCourseMapper;
    /**
     * 查询学员信息列表（包含关联表信息）
     *
     * @param studentReq 学员信息
     * @return 学员信息集合
     */
    @Override
    public List<Student> selectStudentRelevancyList(StudentReq studentReq) {
        return this.getBaseMapper().selectStudentRelevancyList(studentReq);
    }

    /**
     * 查询学员最近一次培训情况
     *
     * @param typeCode 做题类型 practise练习 test考试
     * @param student  传参
     * @return 最近一次培训情况
     */
    @Override
    public Train selectLastTrain(String typeCode, Student student) {
        return this.getBaseMapper().selectLastTrain(typeCode, student);
    }

    /**
     * 查询学员最近一次培训情况
     *
     * @param typeCode   做题类型 practise练习 test考试
     * @param studentIds 学员id列表
     * @return 培训情况
     */
    @Override
    public List<TrainPo> selectTrainByIdList(String typeCode, List<Long> studentIds) {
        return this.getBaseMapper().selectTrainByIdList(typeCode, studentIds);
    }

    /**
     * 查询学员科目 （只返回已审核通过的,未设置开始/到期日期的也不显示）
     *
     * @param studentReq 参数
     * @return 学员科目
     */
    @Override
    public List<StudentPo> selectStudentCourseByDo(Student studentReq) {
        return studentCourseMapper.selectStudentCourseByDo(studentReq);
    }

    /**
     * 查学员列表
     * @param studentDo 参数
     * @return
     */
    @Override
    public List<Student> listStudentPoByDo(StudentDo studentDo) {
        return this.getBaseMapper().listStudentPoByDo(studentDo);
    }

}
